package file;

import java.io.File;

public class FileDemo {
    public static void main(String[] args) {

        File file = new File("./demo.txt");
        //获取文件名
        String name = file.getName();
        //输出
        System.out.println(name);
        //获取文件大小
        long length = file.length();
        System.out.println("文件大小:" + length);

        //是否可读与可写
        boolean cr = file.canRead();
        System.out.println("是否可读:" + cr);
        boolean cw = file.canWrite();
        System.out.println("是否可写:" + cw);

        //是否隐藏
        boolean ih = file.isHidden();
        System.out.println("是否隐藏:" + ih);

    }
}
